﻿#pragma once
#include "TcpIp.h"

// CTcpipDlg 对话框

class CTcpipDlg : public CDialogEx
{
	DECLARE_DYNAMIC(CTcpipDlg)

public:
	CTcpipDlg(CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~CTcpipDlg();

	// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum {
		IDD = IDD_DIALOG_TCPIP
	};
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()

private:
	int m_nPort;
	void ReadEditValueToConfig();
	void ReadConfigToEditValue();
	void SetUiHandle();
	char* m_cIpAddress;
	CEdit m_editSendInf;
	CIPAddressCtrl m_ipTcpipAddress;
	CComboBox m_comboMode;

public:
	CListCtrl m_listTcpReciveInf;
	circular_buffer<LOG_PACKAGE>   m_logBuffer;
	circular_buffer<LOG_PACKAGE>   m_TcpRecBuffer;
	virtual BOOL OnInitDialog();
	virtual void OnCancel();
	afx_msg void OnBnClickedButtonSend();
	afx_msg void OnBnClickedButtonConnect();
	afx_msg LRESULT OnReceiveAndDisplayTCPInf(WPARAM wParam, LPARAM lParam);
	afx_msg void OnBnClickedButtonClose();
	LRESULT OnReceiveAndDisplaySystemLog(WPARAM wParam, LPARAM lParam);
	void OnLvnItemchangedListLog(NMHDR * pNMHDR, LRESULT * pResult);
	void OnNMCustomdrawListLog(NMHDR * pNMHDR, LRESULT * pResult);
	afx_msg void OnBnClickedButtonSave();
};
